package Song.Han.day02.demo04;
/*
* 利用数组返回不同的返回值*/
public class ArrayReturn {
    public static void main(String[] args) {
        int[] result = caculate(10,20,30);

        System.out.println("main方法接收到的返回值是：");
        System.out.println(result);//数组地址
        System.out.println("总和："+result[0]);
        System.out.println("平均值："+result[1]);
    }

    public static int[] caculate(int a,int b,int c){
        int sum = a + b + c;
        int avg = sum/3;
        //两个数据都希望返回

/*
        int[] array = new int[2];
        array[0] = sum;
        array[1] = avg;
*/
        int[] array = {sum , avg};

        return array;
    }
}
